package com.example.config;

import com.example.bean.Student;
import com.example.bean.Teacher;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Conditional;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;

import java.awt.*;

@Configuration
@PropertySource("classpath:teacher.properties")
public class ConditionalConfig {

    @Bean
    @Conditional(WindowsCondition.class)
    public Student windowsStudent(){
        return new Student("windowsStudent", 18);
    }

    @Bean
    @Conditional(MacCondition.class)
    public Student macStudent(){
        return new Student("macStudent", 19);
    }

    @Bean
    public Teacher teacher(){
        return new Teacher();
    }
}
